<!DOCTYPE html>
<html>
  <head>
    <title><%= title %></title>
    <link rel='stylesheet' href='/stylesheets/style.css' />
      <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js" ></script>
      </head>
  <body>
    <h1><%= title %></h1>
    <p>2017-10-9 陈宗豪 201592452 软日1505</p>
    <textarea id="input" rows="10" cols="50"></textarea><br>
    <button type="button" onclick="deal()" value="确认">确认</button>
    <div id="output"></div>

    <a href="/">返回首页</a>
    <div><script src="https://code.csdn.net/snippets/2589294.js"></script></div>

  </body>
  <script>
    var input_text="";
    var deal=function () {
        input_text=$('#input').val();
        var split_text=input_text.split("\n");
//        console.log(split_text);
        $.ajax({
            url:"/test/02",
            type:"post",
            data:JSON.stringify(split_text),
            contentType:"application/json;charset=utf-8",
            dataType:'json',
            success:function(data){
//                console.log(data);
                var display = "";
//                console.log(data);
                for(var i in data){
                    display+="<p>"+i+":";
                    for(var j in data[i]){
                        if(data[i][j]&&data[i][j]!=""&&data[i][j]!=null){
                          display+=data[i][j]+",";
                        }
                    }
                    display=display.substring(0,display.length-1);
                    display+="</p>";
                }
//                alert(display);
                $('#output').html(display);
            }

        })
    }

  </script>
</html>
